﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GCPUD.Autoprov.Network
{
    public class Vlan : IComparable, IEquatable<Vlan>
    {
        private string vlanId;
        private string vlanNum;
        private string vlanName;

        public string VlanId
        {
            get { return vlanId; }
            set { vlanId = value; }
        }
        public string VlanNum
        {
            get { return vlanNum; }
            set { vlanNum = value; }
        }
        public string VlanName
        {
            get { return vlanName; }
            set { vlanName = value; }
        }
        public int CompareTo(object obj)
        {
            if (obj == null) return 1;
            Vlan otherVlan = obj as Vlan;
            if (otherVlan != null)
                return int.Parse(this.VlanNum).CompareTo(int.Parse(otherVlan.VlanNum));
            else
                throw new ArgumentException("Object is not a vlan");
        }
        public static Vlan Copy(Vlan vlan)
        {
            return (Vlan)vlan.MemberwiseClone();
        }
        public override bool Equals(Object obj)
        {
            Vlan vlan_ = obj as Vlan;

            if (vlan_ != null) return Equals(vlan_);
            else return false;
        }
        public bool Equals(Vlan v)
        {
            if ((object)v == null)
            {
                return false;
            }
            return this.VlanNum.Equals(v.VlanNum);
        }


        public override int GetHashCode()
        {
            return this.vlanNum.GetHashCode();
        }
    }
}
